Based on the introduction of the WebService Learning Note Series (ii), using Tcpmon to capture the XML content we send or receive, we will make a simple analysis of these XML content in the next day. Remember in the WebService study Note series (iv) we described in detail the server-side program writing, the service-side program of this article still follow the service-side code, but the series (iv) on the interface of the annotations are not explained in detail, today first to see what the role
returning XML of the SOAP protocolYou can use Tcpmon to capture clearer xmlYou can set your own listening port and then use Tcpmon to forward it.
Instance:
Package org.sid.service;
Import Javax.jws.WebParam;
Import Javax.jws.WebResult;
Import Javax.jws.WebService;
@WebService Public
interface Imyservice {
@WebResult (name= "Addresult") public
int Add (@WebParam (name= "a ") int A, @WebParam (name=" b ") int b);
@
In the Application Scenario, upload an XML file for a file and Click Preview. In this case, upload the XML file to the server, read the XML file, format the returned JSON data, obtain the JSON file, load it to the page, and use the syntaxhighlighter plug-in to dynamically highlight the XML code uploaded in this section. The key code is as follows:
First, upload and rename the file, and then convert the uploaded file into JSON format. The Code is as follows:
@ Requestmapping (value = "fileuploa
will no longer be proxied. Because it's not the port number you're listening to.At the listening type, I selected TCP/IP and then viewed in the returned WSDL file by entering: HTTP://127.0.0.1:9876/HELLOWORLD?WSDL in the Address bar: Time Out: Sets the connection duration for unsuccessful access, which remains at 0, which is not set.After setting, click OK button, then click on the right of the Start button, monitoring has been started.Step Two:Configure the WSDL URL on myeclipse WebService: ht
WSDL mapping annatotion. The WSDL document element that describes the Web Service is associated with the Java source code. 2) @WebParam used to get request parameters3) @WebResult used to define the return value4) @SOAPBinding is a binding annotation used to illustrate network protocols and formats.Use annotation to define the webserviceImportjava.util.List;ImportJavax.jws.WebMethod;ImportJavax.jws.WebParam;ImportJavax.jws.WebResult;ImportJavax.jws.
finally come up with a practical example to illustrate.System: Springmvc+mybatisFirst look at the final:This is followed by code to explain briefly:first get the data through MyBatis, from also can see, I need data one is the medicine name, one is the amount, a simple statistic SQL can complete.Because the data is simple, I use MyBatis to return the value directly with the listThen construct the option structure at the service layer with the following code:@Overridepublic Option selectremovecau
This is the Java Project first is SEI, that is, the server interface class HelloService. java [java] package com. jadyer. service; import javax. jws. webParam; import javax. jws. webResult; import javax. jws. webService;/*** SEI (Service Endpoint Interface) * @ see Methods * @ see here the class-level annotation @ WebService is used to mark the method of this interface as a Web Service * @ see it exposes all methods by default, to shield a Method, use
Description Language wsdl . pdf Https://files.cnblogs.com/files/jiyukai/WebService Description Language wsdl detailed. pdfSecond, use WebService annotations to modify the WSDL file 1. WebService Annotations OverviewThe contents of the WSDL file are generally generated by default, but in order to better provide the developer with a manual, some simple modifications are generally required. At least, we should not expose our package structure. The targetnamespace default is the inverted packag
webservice of MyEclipse, and note that the port for myeclipse TCP/IP monitor is used. Instead of going directly to our published HTTP://127.0.0.1:6666/HELLOWORLD?WSDL How do I modify the contents of a WSDL file? Use WebService annotations. 1, @WebService-Definition services 2, @WebMethod-Definition method 3, @WebResult-Define return value 4, @WebParam-Define parameters Note: For annotations, different versions support the same degree: 1, 1.5 not supp
PartName member of the @WebParam Annotation describes the Wsdl:part in the WSDL document.
5. The PartName member of the @WebResult Annotation describes the value Wsdl:part uses to return the WSDL document.
For example, the following uses annotation to define a webservice:
Import java.util.List;
Import Javax.jws.WebMethod;
Import Javax.jws.WebParam;
Import Javax.jws.WebResult;
Import Javax.jws.WebService;
Import Com.cxf.pojo.User;
@WebService (tar
This article link: http://blog.csdn.net/kongxx/article/details/7544640
Apache CXF One of the actual combat Hello World Web Service
Apache CXF Combat II Integrated sping and Web container
Apache CXF Three-combat Transfer Java objects
Apache CXF Real-combat four build restful Web Service
Apache CXF Combat Five compressed Web service data
Apache CXF Combat Six Create a secure Web Service
Apache CXF Combat Seven use the Web service to transfer files
In CXF, if the Web service return type is map, for
Both the client and server are Java projects. First, list the server code.
The first is sei, that is, helloservice. Java, the server interface class.
package com.jadyer.service;import javax.jws.WebParam;import javax.jws.WebResult;import javax.jws.WebService;import com.jadyer.exception.UserException;@WebService(targetNamespace="http://blog.csdn.net/jadyer")public interface HelloService {@WebResult(name="sayHelloResult")public String sayHello(@WebPar
Sometimes we do not want the client to know the relevant information of the server, at least we should not let him know the package structure of our server.
In this case, we can modify the WSDL in the form of annotations.
Package COM. njupt. webService; import javax. JWS. webmethod; import javax. JWS. webparam; import javax. JWS. webresult; import javax. JWS. webService; import javax. XML. WS. endpoint; // servicename = "myservice" Modify service
WebService has historically been highly valued, especially in the Java Camp, WebService framework and technology. Well-known xfile (new such as CXF), Axis1, Axis2 and so on.and Sun is not far behind, from the early Jax-RPC to now mature, support RPC calls and messaging Jax-WS have been tested by the market, very mature, and using JAX-WS development WebService revenue is very large, it is lightweight. The development of WebService using JAX-WS requires only a few simple steps: The write interfac
Javax.jws.WebService;@WebServicePublic interface HelloWorld {@WebMethod@WebResult string Sayhi (@WebParam string text);}Here we do not introduce @WebService, @WebMethod, @WebResult and how @webparam work.Then we need to use Helloworldimpl to implement this interface class,Package com.cnblog.richaaaard.cxftest.standalone.ws.helloworld.services;public class Helloworldimpl implements HelloWorld {public string
- * @returnString return Data type - */ - @WebMethod ( inOperationname= "Getadd",//Modify the Client access method name -Exclude=false)//false to begin annotation modification to@Override//The first note below: @WebResult (name= "result") modifies the client display to return a parameter name that is worth @WebParam (name= "number") to modify the client parameter name + Public@WebResult (nam
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.